<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
                           http://www.springframework.org/schema/beans/spring-beans.xsd
                           http://www.springframework.org/schema/context 
                           http://www.springframework.org/schema/context/spring-context.xsd">

	<!-- Define the controllers using annotations -->
    <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/>
    <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/>
	<context:component-scan base-package="de.cms.kff.ctrl"/>
	
	<!-- ******************* -->
	<!-- DB and Hibernate    -->
	<!-- ******************* -->
	
    <bean class="de.cms.kff.Startup" id="init" init-method="initDB">
		<property name="driverClass" value="com.mysql.jdbc.Driver" />
		<property name="user" value="root" />
		<property name="password" value="" />
		<property name="defaultDBurl" value="jdbc:mysql://localhost:3306/mysql" />
		<property name="newDB" value="fahrtenbuchcms" />
    </bean>

	<bean id="dataSource"
		class="com.mchange.v2.c3p0.ComboPooledDataSource"
		 depends-on="init">
		<property name="driverClass" value="com.mysql.jdbc.Driver" />
		<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/fahrtenbuchcms" />
		<property name="user" value="root" />
		<property name="password" value="" />
		<property name="minPoolSize" value="2" />
      	<property name="maxPoolSize" value="4" />
	</bean>
	
	<import resource="DataAccess.xml"/>	
	
	<import resource="springsecurity.xml"/>
	
	<!-- ******************* -->
	<!-- Controllers         -->
	<!-- ******************* -->
	
	<bean id="mitarbeiterController" class="de.cms.kff.ctrl.MitarbeiterController">
		<property name="mitarbeiterDao" ref="mitarbeiterDao" />
	</bean>
	
	<bean id="autoController" class="de.cms.kff.ctrl.AutoController">
		<property name="autoDao" ref="autoDao" />
	</bean>
	
	<bean id="verleihController" class="de.cms.kff.ctrl.VerleihController">
		<property name="verleihDao" ref="verleihDao" />
		<property name="autoDao" ref="autoDao" />
		<property name="mitarbeiterDao" ref="mitarbeiterDao" />
	</bean>
	
	<!-- ******************* -->
	<!-- Views               -->
	<!-- ******************* -->
	
	<!-- Als Präfix den Name z.B. home von der Controller Datei -->
	<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="prefix" value="/view/" />
		<property name="suffix" value=".jsp" />
	</bean>
	
</beans>